package com.zhengbaochuan.web.action.fileserver.file;

import java.io.File;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import com.zhengbaochuan.web.action.util.BaseAction;

public class FileSeeAction extends BaseAction<Object>  {
	
	 public void findSystemFileRoot(){
		 File[] roots = File.listRoots();
		 JSONArray ja = new JSONArray();
		 JSONObject jo = null;
		   for (File file : roots) {
			   jo = new JSONObject();
			   System.out.println(file.getFreeSpace());
			   System.out.println(file.getUsableSpace());
			   jo.accumulate("path", file.getPath())
			   .accumulate("canUse", file.getFreeSpace()/1024/1024/1024)
			   .accumulate("haveUse", file.getUsableSpace()/1024/1024/1024)
			   .accumulate("total", file.getTotalSpace()/1024/1024/1024);
			   ja.add(jo);
		     }
		   this.writeJSON(ja.toString());
	 }
	
}
